home *** CD-ROM | disk | FTP | other *** search
- /** MarginBell.vlt
- *
- * Example program to intercept keystrokes.
- * This one implements a margin bell at 72 colums
- *
- **/
-
- margincol = 72
- /*
- * Open a port
- */
- mp = openport(MARGIN_BELL)
- /*
- * Tell VLT to send us stuff
- */
- "wedge keystrokes MARGIN_BELL"
- /*
- * Loop until quitflag is 1, waiting for packets
- */
- do forever
- if quitflag = 1 then leave
- t = waitpkt(MARGIN_BELL)
- /*
- * We got a number of packets. Loop over all of them.
- */
- do ff = 1
- p = getpkt(MARGIN_BELL)
- if c2d(p) = 0 then leave ff
- line = getarg(p)
- t = reply(p, 1)
- /*
- * Got something. Find out what...
- */
- parse var line command code qual iaddr char .
- /*
- * If we got an "esc", quit.
- */
- if char = '1B'x then do
- quitflag = 1
- "$1: BEEP; delay .7; BEEP; delay .7; BEEP"
- end
- /*
- * Else check the current cursor x position. Send VLT a BEEP command if it
- * is at the margin column.
- */
- else do
- "extract x"
- if VLT.x = margincol then "BEEP"
- end
- end
- end
-
-